package com.h3c.nem.task;

import com.h3c.nem.service.ITbTeacherService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@JobHandler(value="syncTeacherGradeHandler")
@Component
public class SyncTeacherGradeHandler  extends IJobHandler {

    @Autowired
    private ITbTeacherService tbTeacherService;

    @Override
    public ReturnT<String> execute(String param) throws Exception {
        XxlJobLogger.log("XXL-JOB, syncTeacherGradeHandler.");
        XxlJobLogger.log("准备开始调用方法");
        try {
            tbTeacherService.syncGrade();
        }catch (Exception e){
            e.printStackTrace();
            XxlJobLogger.log(e.getMessage());
            return FAIL;
        }
        XxlJobLogger.log("调用结束");
        return SUCCESS;
    }
}
